home *** CD-ROM | disk | FTP | other *** search
/ Developer Helper 1: Phil & Dave's Excellent CD / Excellent CD HFS.raw / Moof / Goodies / HyperCard Goodies / AppleTalk Stuff / HyperAppleTalk / ATP / ATPClose.c next >
Text File  |  1988-02-10  |  3KB  |  75 lines

  1. /*******************************************************************\
  2. *    file:         AtpClose.c                                            *
  3. *    version:    1.06ß                                                *
  4. *                                                                     *
  5. * This command disassociates the node with the network.                *
  6. *                                                                    *
  7. * -----------------------------------------------------------------    *
  8. * By:     Donald Koscheka, Greg Kimberly                                *
  9. * Date:    21-Sept-87                                                    *
  10. * ©    Copyright 1987, Apple Computer, Inc.                            *
  11. *    All Rights Reserved                                                *
  12. *                                                                    *
  13. * -----------------------------------------------------------------    *
  14. *                        Modification History                        *
  15. * -----------------------------------------------------------------    *
  16. *  Date           | By    |                     Description                    *
  17. * -----------------------------------------------------------------    *
  18. * 21-Sep-87    | GK    | file created                                    *
  19. *  5-Nov-87    | DK    | added return result                            *
  20. * 11-Dec-87    | DK    | put disposHandle into atKill                    *
  21. * 14-Jan-88    | DK    | modified to reflect decoupling of atp and nbp    *
  22. *            |        | (clears out global address container)            *
  23. * -----------------------------------------------------------------    *
  24. \*******************************************************************/
  25.  
  26. /*******************************************************************\
  27.                             Build Sequence
  28. C -q2 -g -o "{hpo}"ATPClose.c.o "{atp}"ATPClose.c
  29.     link  -sn Main=ATPClose -sn STDIO=ATPClose ∂
  30.          -sn INTENV=ATPClose -rt XCMD=300 ∂
  31.          -m ATPCLOSE ∂
  32.           "{hpo}"ATPClose.c.o "{hpo}"atalkxcmd.c.o "{hpo}"xcmdutils.c.o ∂
  33.          "{CLibraries}"CInterface.o ∂
  34.          "{Libraries}"Interface.o ∂
  35.          -o "{hp}"HyperAppleTalk
  36.  
  37. \*******************************************************************/
  38.  
  39. #include <Types.h>
  40. #include <Memory.h>
  41. #include <Resources.h>
  42. #include <OSUtils.h>
  43. #include <appleTalk.h>
  44. #include <HyperXCmd.h>
  45. #include <atalkXCMD.h>
  46. #include <XCMDUtils.h>
  47.  
  48. pascal void ATPClose(paramPtr)
  49.     XCmdBlockPtr    paramPtr;
  50. /**********************************
  51. * Close down access to the network 
  52. * deallocating all memory used by
  53. * the session.
  54. *
  55. * In:    nil
  56. *
  57. * Out: Error Result is returned to hypercard
  58. **********************************/
  59. {
  60.     ATPBlock     *atp;
  61.     short        result = noErr;
  62.     
  63.     atp = (ATPBlock *)RetrieveHandle(paramPtr, GLOBALATPDATA);
  64.     if( atp ){
  65.         if( atp->checkPoint == RECEIVING )    /*** we're in a callback, so hold off    ***/
  66.             atp->checkPoint = CLOSE_NOW;    /*** on the close until callback is done***/
  67.         else{                                /*** if we're not in a callback, we can ***/    
  68.             result = ATPKill( atp );        /*** close down immediately.            ***/
  69.             SaveHandle( paramPtr, GLOBALATPDATA, nil );
  70.         }
  71.     }
  72.     paramPtr->returnValue = ErrorReturn( result );
  73. }
  74.  
  75.